-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically join if filtering by relationship field #550
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for fastapi-filter ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Removed missed outerjoins left in the tests
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #550 +/- ##
===========================================
- Coverage 100.00% 98.17% -1.83%
===========================================
Files 6 6
Lines 193 219 +26
===========================================
+ Hits 193 215 +22
- Misses 0 4 +4
|
I have looked a bit more into what was causing the tests to fail and reworked everything to pass it. Nested behavior was not tested yet. I actually think it is possible to modify what it is already in place slightly to test nested filters too (e.g., the In my application I am already filtering in both nested and many-to-many relationships without any evidence of problems. I can commit to the task more if it is something actually of interest. |
This aims to be a first tentative approach at avoiding the need for manual joining when filtering a table.
Before the filtering itself relationship of the models are retrieved. If one of the filtering field is associated with a relationship and it contains values not only null values the corresponding table is joined. This accommodates for nested filters and tables connected through a secondary table.
I call this change tentative for three main reasons: